.TH std::plus 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::plus \- std::plus

.SH Synopsis
   Defined in header <functional>
   template< class T >             \fI(until C++14)\fP
   struct plus;
   template< class T = void >      \fI(since C++14)\fP
   struct plus;

   Function object for performing addition. Effectively calls operator+ on two
   instances of type T.

.SH Specializations

   The standard library provides a specialization of std::plus when T is
   not specified, which leaves the parameter types and return type to be
   deduced.
                                                                          \fI(since C++14)\fP
   plus<void> function object implementing x + y deducing parameter and
   \fI(C++14)\fP    return types
              \fI(class template specialization)\fP

.SH Member types

   Type                                                         Definition
   result_type (deprecated in C++17)(removed in C++20)          T
   first_argument_type (deprecated in C++17)(removed in C++20)  T
   second_argument_type (deprecated in C++17)(removed in C++20) T

   These member types are obtained via publicly inheriting                \fI(until C++11)\fP
   std::binary_function<T, T, T>.

.SH Member functions

   operator() returns the sum of two arguments
              \fI(public member function)\fP

std::plus::operator()

   T operator()( const T& lhs, const T& rhs ) const;            \fI(until C++14)\fP
   constexpr T operator()( const T& lhs, const T& rhs ) const;  \fI(since C++14)\fP

   Returns the sum of lhs and rhs.

.SH Parameters

   lhs, rhs - values to sum

.SH Return value

   The result of lhs + rhs.

.SH Exceptions

   May throw implementation-defined exceptions.

.SH Possible implementation

   constexpr T operator()(const T& lhs, const T& rhs) const
   {
       return lhs + rhs;
   }
